<?php
include ("editor.php");

$year=date('Y');
$yearlast=$year+488;
$Year = date("Y")+544;
?>
<style type="text/css">
.messagebox{
    position:absolute;
    width:100px;
    margin-left:5px;
    border:1px solid #c93;
    background:#ffc;
    padding:3px;
}
.messageboxok{
    position:absolute;
    width:auto;
    margin-left:5px;
    border:1px solid #349534;
    background:#C9FFCA;
    padding:3px;
    font-weight:bold;
    color:#008000;
}
.messageboxerror{
    position:absolute;
    width:auto;
    margin-left:5px;
    border:1px solid #CC0000;
    background:#F7CBCA;
    padding:3px;
    font-weight:bold;
    color:#CC0000;
}
.messageboxx{
    position:absolute;
    width:100px;
    margin-left:5px;
    border:1px solid #c93;
    background:#ffc;
    padding:3px;
}
.messageboxxok{
    position:absolute;
    width:auto;
    margin-left:5px;
    border:1px solid #349534;
    background:#C9FFCA;
    padding:3px;
    font-weight:bold;
    color:#008000;
}
.messageboxxerror{
    position:absolute;
    width:auto;
    margin-left:5px;
    border:1px solid #CC0000;
    background:#F7CBCA;
    padding:3px;
    font-weight:bold;
    color:#CC0000;
}
</style>
<script type="text/javascript">

$(document).ready(function()
{
	$("#user_name").blur(function()
	{
		//	var urls='<?php echo "".WEB_URL."";?>';
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");

		//check the username exists or not from ajax
		$.post("modules/member/checkuser.php",{ user_name:$(this).val() } ,function(data)
        {
		  if(data=='no') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_USER_MESS_NO;?>').addClass('messageboxerror').fadeTo(900,1);
			});		
          }
		  else if(data=='empty') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_USER_MESS_NULL;?>').addClass('messageboxerror').fadeTo(900,1);
			});		
          }
		  else if(data=='fort') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_USER_MESS_SHORT;?>').addClass('messageboxerror').fadeTo(900,1);
			});		
          }
		  else
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_USER_MESS_ACC;?>').addClass('messageboxok').fadeTo(900,1);	
			});
		  }
				
        });
 	});

	$("#email").blur(function()
	{
	//		var urls='<?php echo "".WEB_URL."";?>';
		//remove all the class add the messagebox classes and start fading
		$("#msgboxx").removeClass().addClass('messageboxx').text('Checking...').fadeIn("slow");

		//check the username exists or not from ajax
		$.post("modules/member/checkemail.php",{ email:$(this).val() } ,function(datas)
        {
		  if(datas=='no') //if username not avaiable
		  {
		  	$("#msgboxx").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_EMAIL_MESS_NO;?>').addClass('messageboxxerror').fadeTo(900,1);
			});		
          }
		  else if(datas=='empty') //if username not avaiable
		  {
		  	$("#msgboxx").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_EMAIL_MESS_NULL;?>').addClass('messageboxxerror').fadeTo(900,1);
			});		
          }
		  else if(datas=='invalid') //if username not avaiable
		  {
		  	$("#msgboxx").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_EMAIL_MESS_SHORT;?>').addClass('messageboxxerror').fadeTo(900,1);
			});		
          }
		  else
		  {
		  	$("#msgboxx").fadeTo(200,0.1,function()  //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('<?php echo _MEMBER_MOD_CHECK_EMAIL_MESS_ACC;?>').addClass('messageboxxok').fadeTo(900,1);	
			});
		  }
				
        });
 
	});
});

</script>

<table width="750"  border="0" align="center" CELLPADDING="0" CELLSPACING="0">
<tr>
<td width="10" vAlign=top</td>
<td width="740" vAlign=top colspan="2">

&nbsp;&nbsp;<img SRC="images/menu/textmenu_member.gif" BORDER="0">
<table width="740" align=center cellSpacing=0 cellPadding=0 border=0>
<tr>
<td height="1" class="dotline" colspan="4"></td>
</tr>
<tr>

<td width="95%"><table width="740" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<tr>
<td> </td>
</tr>
<tr>
<td Valign="top">
<form name ="checkForm" ACTION="?name=member&file=member_add_new" METHOD="post" onSubmit="return check()" ENCTYPE="multipart/form-data">
<table width="640" BORDER="0" align="center" CELLPADDING="2" CELLSPACING="3" >

<tr>
<td COLSPAN="2">
<P align="center"> <strong>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_TITLE;?></font></strong></P></td>
</tr>
<tr>
<td width="100%" align="left" bgcolor="#0099FF" colspan="2">&nbsp;&nbsp;<img SRC="images/admin/user.gif" ><font color="#FFFFFF"><b>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_TITLE_LOGIN;?></font></td>
</tr>
<tr>
<td width="30%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;Login Name : </font></strong></font></td>
<td bgcolor="#FFFFFF">
<input name="user_name" TYPE="text" ID="user_name" size="20" maxlength="30" >
<font COLOR="#FF0000" >&nbsp;**</font><span id="msgbox" style="display:none"></span></td>
</tr>
<tr>
<td width="30%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong>Password : </strong></font></td>
<td bgcolor="#FFFFFF">
<input name="pwd_name1" TYPE="password" ID="pwd_name1" size="20" maxlength="30">
&nbsp;<font COLOR="#FF0000" >**</font> </font></td>
</tr>
<tr>
<td width="30%" align="right" bgcolor="#FFFFFF"><strong>Re-password : </font></strong></font></td>
<td bgcolor="#FFFFFF">
<input name="pwd_name2" TYPE="password" ID="pwd_name2" size="20" maxlength="30">
&nbsp;<font COLOR="#FF0000" >**</font> </font></td>
</tr>
<tr>
<td width="30%" align="right" bgcolor="#FFFFFF"><strong>Email : </font></strong></font></td>
<td bgcolor="#FFFFFF">
<input name="email" TYPE="text" ID="email" maxlength="30" >
&nbsp;<font COLOR="#FF0000" >**</font><span id="msgboxx" style="display:none"></span></td>
</tr>
<tr>
<tr>
<td width="100%" align="left" bgcolor="#0099FF" colspan="2">&nbsp;&nbsp;<img SRC="images/admin/user.gif" ><font  color="#FFFFFF"><b>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_USER_DETAIL_TITLE;?></font></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _MEMBER_MOD_FORM_USER_NAME;?> :</td>
<td width=345 height=2><input maxLength=30 size=45 name=first_name>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _MEMBER_MOD_FORM_USER_SUR;?> :</td>
<td width=345><input maxLength=40 size=45 name=last_name>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _MEMBER_MOD_FORM_USER_NICK;?> :</td>
<td width=345><input maxLength=20 size=45 name=nic_name>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _MEMBER_MOD_FORM_USER_BIRTH;?> :</td>
<?php
$dt=date('d');
$mt=date('m');
$yy=date('Y');
$yt=$yy+543;
echo "<td width=400><SELECT name=day>
<option >--</option>";
for($i=1;$i<32;$i++){
echo 	"<option value=$i>$i</option>";
}
echo "</select>";
$vmont  = array(_F_Month_1, _F_Month_2, _F_Month_3, _F_Month_4, _F_Month_5, _F_Month_6, _F_Month_7, _F_Month_8, _F_Month_9, _F_Month_10, _F_Month_11, _F_Month_12);

echo "<select  name=month size=1>
<option >------------</option>";
for($i=0;$i<count($vmont);$i++){
$ss=$i+1;
echo 	"<option value=$ss>$vmont[$i]</option>";
}
echo "</select>";

echo "<select  name=year size=1>
<option >------</option>";
for($a=$yearlast;$a<$Year;$a++){
echo 	"<option value=$a>$a</option>";
}
echo "</select>";

?>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _ALUM_MOD_FORM_OLD;?> :</td>
<td width=345><input name=age id="age" size=4 maxLength=2>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr vAlign=top>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _ALUM_MOD_FORM_SEX;?> :</td>
<td width=345><input name=sex type=radio value=1 checked>
<img src="modules/alumnus/img/male.gif" > <?php echo _ALUM_MOD_FORM_SEX_MAN;?>
<input type=radio value=2 name=sex>
<img src="modules/alumnus/img/female.gif"> <?php echo _ALUM_MOD_FORM_SEX_GIRL;?>
<input type=radio value=3 name=sex>
<img src="modules/alumnus/img/notsoure.gif"> <?php echo _ALUM_MOD_FORM_SEX_BI;?><img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _ALUM_MOD_FORM_ADD;?> : </strong></font></font></td>
<td bgcolor="#FFFFFF"><input name="address" TYPE="text" ID="address" size="50" maxlength="150"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;<?php echo _ALUM_MOD_FORM_AMP;?> : </font></strong></td>
<td bgcolor="#FFFFFF">
<input name="amper" TYPE="text" ID="amper" size="30">
</font></td>
</tr>
<tr vAlign=top>
<td vAlign=center align=right width="21%"><strong>&nbsp;&nbsp;<?php echo _ALUM_MOD_FORM_PROV;?> :</td>
<td width=345><?php
$vprovince  = array(_PROVINCE_1, _PROVINCE_2, _PROVINCE_3, _PROVINCE_4, _PROVINCE_5, _PROVINCE_6, _PROVINCE_7, _PROVINCE_8, _PROVINCE_9, _PROVINCE_10, _PROVINCE_11, _PROVINCE_12, _PROVINCE_13, _PROVINCE_14, _PROVINCE_15, _PROVINCE_16, _PROVINCE_17, _PROVINCE_18, _PROVINCE_19, _PROVINCE_20, _PROVINCE_21, _PROVINCE_22, _PROVINCE_23, _PROVINCE_24, _PROVINCE_25, _PROVINCE_26, _PROVINCE_27, _PROVINCE_28, _PROVINCE_29, _PROVINCE_30, _PROVINCE_31, _PROVINCE_32, _PROVINCE_33, _PROVINCE_34, _PROVINCE_35, _PROVINCE_36, _PROVINCE_37, _PROVINCE_38, _PROVINCE_39, _PROVINCE_40, _PROVINCE_41, _PROVINCE_42, _PROVINCE_43, _PROVINCE_44, _PROVINCE_45, _PROVINCE_46, _PROVINCE_47, _PROVINCE_48, _PROVINCE_49, _PROVINCE_50, _PROVINCE_51, _PROVINCE_52, _PROVINCE_53, _PROVINCE_54, _PROVINCE_55, _PROVINCE_56, _PROVINCE_57, _PROVINCE_58, _PROVINCE_59, _PROVINCE_60, _PROVINCE_61, _PROVINCE_62, _PROVINCE_63, _PROVINCE_64, _PROVINCE_65, _PROVINCE_66, _PROVINCE_67, _PROVINCE_68, _PROVINCE_69, _PROVINCE_70, _PROVINCE_71, _PROVINCE_72, _PROVINCE_73, _PROVINCE_74, _PROVINCE_75, _PROVINCE_76, _PROVINCE_77);
echo "<select  name=province size=1 >
<option >------------</option>";
for($i=0;$i<count($vprovince);$i++){
echo 	"<option value=$vprovince[$i]>".$vprovince[$i]."</option>";
}
echo "</select>";
?>
<img src="modules/alumnus/img/priority.gif" width="11" height="12"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;<?php echo _ALUM_MOD_FORM_POST;?> : </strong></font></font></td>
<td bgcolor="#FFFFFF"><input name="zipcode" TYPE="text" ID="zipcode"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;<?php echo _ALUM_MOD_FORM_TEL;?> : </strong></font></font></td>
<td bgcolor="#FFFFFF"><input name="phone" TYPE="text" ID="phone"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_USER_EDU;?> : </strong></font></td>
<td bgcolor="#FFFFFF">
<?php
$education  = array(_EDU_1, _EDU_2, _EDU_3, _EDU_4, _EDU_5, _EDU_6, _EDU_7);
echo "<select  name=education size=1 >
<option >------------</option>";
for($i=0;$i<count($education);$i++){
echo 	"<option value=$education[$i]>".$education[$i]."</option>";
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF"><strong>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_USER_WORK;?> : </strong></font></td>
<td bgcolor="#FFFFFF">
<?php
$vwork  = array(_WORK_1, _WORK_2, _WORK_3, _WORK_4, _WORK_5, _WORK_6, _WORK_7, _WORK_8, _WORK_9, _WORK_10, _WORK_11, _WORK_12, _WORK_13, _WORK_14, _WORK_15, _WORK_16, _WORK_17, _WORK_18, _WORK_19, _WORK_20, _WORK_21, _WORK_22, _WORK_23);
echo "<select  name=work size=1 >
<option >------------</option>";
for($i=0;$i<count($vwork);$i++){
echo 	"<option value=$vwork[$i]>".$vwork[$i]."</option>";
}
echo "</select>";
?>
</font></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;&nbsp;<strong><?php echo _ALUM_MOD_FORM_OFFICE;?> : </strong></font></font></td>
<td bgcolor="#FFFFFF"><input name="office" TYPE="text" ID="office" size="50" maxlength="150"></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF" valign="top"><strong>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_USER_SIG;?> : </strong></font></td>
<td bgcolor="#FFFFFF">
    <textarea cols="70" id="editor1" rows="5"  name="signature" ></textarea>
</td>
</tr>
<?php /*
<tr>
    <td align="right" bgcolor="#FFFFFF">
        <strong>&nbsp;&nbsp;<?php echo _MEMBER_MOD_FORM_USER_PIC;?> : </strong>
    </td>
    <td bgcolor="#FFFFFF">
        <input TYPE="file" name="FILE" style="width:250" class="inputform">
    <BR>
    Limit <?php echo (_MEMBER_LIMIT_UPLOAD/1024);?> kB, [ width x height ]=100x80 pixels
    </td>
</tr>
*/ ?>
<?php
if(USE_CAPCHA){
?>
<tr>
<td width="21%" align="right">
<?php if(CAPCHA_TYPE == 1){ 
echo "<img src=\"capcha/CaptchaSecurityImages.php?width=".CAPCHA_WIDTH."&height=".CAPCHA_HEIGHT."&characters=".CAPCHA_NUM."\" width=\"".CAPCHA_width."\" height=\"".CAPCHA_HEIGHT."\" align=\"absmiddle\" />";
}else if(CAPCHA_TYPE == 2){ 
echo "<img src=\"capcha/val_img.php?width=".CAPCHA_WIDTH."&height=".CAPCHA_HEIGHT."&characters=".CAPCHA_NUM."\" width=\"".CAPCHA_width."\" height=\"".CAPCHA_HEIGHT."\" align=\"absmiddle\" />";
};?>
</td>
<td><input name="security_code" TYPE="text" ID="security_code" maxlength="6" >&nbsp;<font COLOR="#FF0000" >**</font>&nbsp;<B><font COLOR="#FF0000" ><?php echo _MEMBER_MOD_FORM_USER_SPAM;?></font></B></td>
</tr>
<?php 
}
//ระบบสมาชิกเสริม maxsite 1.10 พัฒนาโดย www.narongrit.net

?>

<tr>
<td align="right" bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF"><font COLOR="#0000FF"><?php echo _MEMBER_MOD_FORM_ADD_SENDEMAIL;?> <BR>
<?php echo _MEMBER_MOD_FORM_ADD_SENDEMAIL2;?>&nbsp;</font><font COLOR="#0000FF" size="2">&nbsp;</font><font COLOR="#0000FF" size="1"><strong>&nbsp; </strong></font></font></td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="21%" align="right" bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF">
<input TYPE="submit" name="Submit" VALUE="<?php echo _MEMBER_MOD_FORM_BUTTON_ADD;?>">
<input TYPE="hidden" name="signup" VALUE="date()"> 
&nbsp;
<input TYPE="reset" name="Submit2" VALUE="<?php echo _MEMBER_MOD_FORM_BUTTON_CLEAR;?>">
<input name="ok" TYPE="hidden" ID="ok2" VALUE="ok_pass">
</td>
</tr>
</table>
<script type="text/javascript">

function check() {
var x=document.forms["checkForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("<?php echo _MEMBER_MOD_FORM_JAVA_EMAIL;?>");
return false;
}

if(document.checkForm.name.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_USER;?>") ;
document.checkForm.name.focus() ;
return false ;
}
else if(document.checkForm.year.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_BIRTH;?>") ;
document.checkForm.year.focus() ;
return false ;
}
else if(isNaN(document.checkForm.year.value)) {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_YEAR;?>") ;
document.checkForm.year.focus() ;
return false ;
}
else if(document.checkForm.age.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_AGE;?>") ;
document.checkForm.age.focus() ;
return false ;
}
else if(isNaN(document.checkForm.age.value)) {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_AGE_NUM;?>") ;
document.checkForm.age.focus() ;
return false ;
}
else if(document.checkForm.province.selectedIndex==0) {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_PROV;?>") ;
return false ;
}
else if(isNaN(document.checkForm.zipcode.value)) {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_POST;?>") ;
document.checkForm.zipcode.focus() ;
return false ;
}
else if(document.checkForm.user_name.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_USERname;?>") ;
document.checkForm.user_name.focus() ;
return false ;
}
else if(document.checkForm.pwd_name1.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_PASS;?>") ;
document.checkForm.pwd_name1.focus() ;
return false ;
}
else if(document.checkForm.pwd_name2.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_PASS_CONF;?>") ;
document.checkForm.pwd_name2.focus() ;
return false ;
}
else if(document.checkForm.pwd_name1.value != document.checkForm.pwd_name2.value) {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_PASS_NOTMATT;?>") ;
document.checkForm.pwd_name2.focus() ;
return false ;
}
else if(document.checkForm.email.value=="") {
alert("<?php echo _MEMBER_MOD_FORM_JAVA_EMAIL_NULL;?>") ;
return false ;
}
else
return true ;
}
</script>
<BR>
<BR>
<BR>
<BR>
</form></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
